package com.gaocf.designpatterns.behavior.strategy;

/**
 * @author gaocf
 * 简单工厂设计模式
 */
public class CashFactory {
    public static Cash createCashObject(int type) {
        Cash cash = null;
        switch (type) {
            case 1:
                cash = new NormalCash();
                break;
            case 2:
                cash = new DiscountCash(0.85);
                break;
            case 3:
                cash = new RebateCash("300", "100");
                break;
            default:
                cash = new NormalCash();
                break;
        }
        return cash;
    }
}
